<?php
namespace App\Models\System;

use Illuminate\Database\Eloquent\Model;

class Backlog extends Model{

    protected $table = 'backlogs'; 

    //[]所有数据都可以批量赋值
    protected $guarded = ['type_name'];

    public function getTypeNameAttribute(){
        $type = $this->attributes['type'];

        $result = '';
        if($type) {
            switch($type) {
                case 1: $result = '研修活动'; break;
                case 2: $result = '专题培训'; break;
                case 3: $result = '研修培训'; break;
                case 4: $result = '论文管理'; break;
                case 5: $result = '论著管理'; break;
                case 6: $result = '课题研究'; break;
                case 7: $result = '资源管理'; break;
                case 8: $result = '获奖信息'; break;
                case 9: $result = '月考核'; break;
            }
        }

        return $result;
    }
}

?>